#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    int n, q; cin >> n >> q;
    vector<int> arr(n);
    for(auto& e : arr) cin >> e;
    while(q--)
    {
        int k; cin >> k;
        auto l = lower_bound(arr.begin(), arr.end(), k);
        auto r = lower_bound(arr.begin(), arr.end(), k + 1);
        if(l == arr.end() || l >= r)
            cout << "-1 -1\n";
        else
            cout << (l - arr.begin()) << " " << (r - arr.begin() - 1) << endl;
    }
}